package com.jingdianjichi.wx.enums;

public enum WxMsgTypeEnum {

    SUBSCRIBE("event.subscribe","用户关注"),
    SEND_TEXT("text","用户发送文本消息");

    private String msgType;
    private String desc;

    WxMsgTypeEnum(String msgType,String desc) {
        this.msgType = msgType;
        this.desc = desc;
    }

    /**
     * 根据消息类型获取对应的 枚举
     * @param msgType
     * @return
     */
    public static WxMsgTypeEnum getEnumByMsgType(String msgType) {
        for (WxMsgTypeEnum value : WxMsgTypeEnum.values()) {
            if (value.msgType.equals(msgType)) {
                return value;
            }
        }
        return null;
    }

}
